import 'package:trollee/generated/json/base/json_convert_content.dart';
import 'package:trollee/app/data/entities/basic/news_entity.dart';

NewsEntity $NewsEntityFromJson(Map<String, dynamic> json) {
	final NewsEntity newsEntity = NewsEntity();
	final int? curpage = jsonConvert.convert<int>(json['curpage']);
	if (curpage != null) {
		newsEntity.curpage = curpage;
	}
	final int? allnum = jsonConvert.convert<int>(json['allnum']);
	if (allnum != null) {
		newsEntity.allnum = allnum;
	}
	final List<NewsList>? newslist = jsonConvert.convertListNotNull<NewsList>(json['newslist']);
	if (newslist != null) {
		newsEntity.newslist = newslist;
	}
	return newsEntity;
}

Map<String, dynamic> $NewsEntityToJson(NewsEntity entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['curpage'] = entity.curpage;
	data['allnum'] = entity.allnum;
	data['newslist'] =  entity.newslist?.map((v) => v.toJson()).toList();
	return data;
}

NewsList $NewsListFromJson(Map<String, dynamic> json) {
	final NewsList newsList = NewsList();
	final String? id = jsonConvert.convert<String>(json['id']);
	if (id != null) {
		newsList.id = id;
	}
	final String? ctime = jsonConvert.convert<String>(json['ctime']);
	if (ctime != null) {
		newsList.ctime = ctime;
	}
	final String? title = jsonConvert.convert<String>(json['title']);
	if (title != null) {
		newsList.title = title;
	}
	final String? description = jsonConvert.convert<String>(json['description']);
	if (description != null) {
		newsList.description = description;
	}
	final String? xSource = jsonConvert.convert<String>(json['source']);
	if (xSource != null) {
		newsList.xSource = xSource;
	}
	final String? picUrl = jsonConvert.convert<String>(json['picUrl']);
	if (picUrl != null) {
		newsList.picUrl = picUrl;
	}
	final String? url = jsonConvert.convert<String>(json['url']);
	if (url != null) {
		newsList.url = url;
	}
	return newsList;
}

Map<String, dynamic> $NewsListToJson(NewsList entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['id'] = entity.id;
	data['ctime'] = entity.ctime;
	data['title'] = entity.title;
	data['description'] = entity.description;
	data['source'] = entity.xSource;
	data['picUrl'] = entity.picUrl;
	data['url'] = entity.url;
	return data;
}
